package com.huanwei.cc.base;

import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.view.View;

import com.huanwei.map.AdaptationClass;

public abstract class BaseActivity2 extends AppCompatActivity {
    protected AdaptationClass mAdaptationClass;

    @Override
    public void setContentView(View view) {
        super.setContentView(view);
//        initView();
//        initConfig();
//        initData();
//        initEvent();
    }



    public int getZoom(int length) {
        if (mAdaptationClass == null) {
            DisplayMetrics dm = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(dm);
            mAdaptationClass = new AdaptationClass(dm.widthPixels,
                    dm.heightPixels, dm.density);
        }
        return mAdaptationClass.getZoomX(length);
    }

    public AdaptationClass getmAdaptationClass(){
        if (mAdaptationClass == null) {
            DisplayMetrics dm = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(dm);
            mAdaptationClass = new AdaptationClass(dm.widthPixels,
                    dm.heightPixels, dm.density);
        }
        return mAdaptationClass;
    }


    public int getScreenHeight(){
        return (int)mAdaptationClass.getCurHeight();
    }







    protected void initView(){

    }

    //初始化适配相关
    protected void initConfig(){

    }
    protected void initData(){

    }

    protected void initEvent(){

    }


}
